package com.gump.essay.demo.netty;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

/**
 * @auther zzc
 * @date 2020/9/1 15:49
 * 概要：
 */
public class Channeler {
    public static void main(String[] args) throws IOException {

        String str = "zzc";
        FileOutputStream fileoutputStream = new FileOutputStream("D:\\file.txt");
        FileChannel fileChannel = fileoutputStream.getChannel();
        ByteBuffer buffer = ByteBuffer.allocate(1024);
        buffer.put(str.getBytes());
        buffer.flip();
        fileChannel.write(buffer);
        fileChannel.close();

        copyFile();
    }

    private static void copyFile() {
        //todo
    }
}
